<div class="nav">
    <a class="sel" href="{:U('index')}">菜单列表</a>
    <a href="{:U('add')}">添加菜单</a>
</div>
<div class="search">
    <select name="parent_id" id="parent_id" class="sel1">
        <option value="0">所有类别</option>
        <foreach name="top" item="item_t">
            <option value="{$item_t.menu_id}" >{$item_t.menu_name}</option>
        </foreach>
    </select>
</div>
<div class="list">
    <table class="table_list">
        <thead><tr>
                <td>菜单ID</td>
                <td>图标</td>
                <td>菜单名称</td>
                <td>菜单链接</td>
                <td>打开方式</td>
                <td>特殊权限</td>
                <td>首页推荐</td>
                <td>顺序编号</td>
                <td>是否启用</td>
                <td>操作</td>
            </tr>
        </thead>
        <tbody>
        <foreach name="list" item="list">
            <tr>
                <td>{$list.menu_id}</td>
                <td><if condition="!empty($list['ico'])"><span class="glyphicon {$list.ico}"></span></if></td>
                <td style="text-align: left;">
                    {$list.menu_name}</td>
                <if condition="$list['menu_type'] eq 1">
                <td>{$list.menu_link}</td>
                <td>{$list.target}</td>
                <td>{$list.purview}</td>
                <td class="edit_toggle" attr_t="is_index" attr_id="{$list.menu_id}">{$list.is_index}</td>
                <else />
                <td>- -</td>
                <td>- -</td>
                <td>- -</td>
                <td>- -</td>
                </if>
                <td class="edit_input" attr_t="order_id" attr_id="{$list.menu_id}">{$list.order_id}</td>
                <td class="edit_toggle" attr_t="is_enable" attr_id="{$list.menu_id}">{$list.is_enable}</td>
                <td><a class="btn_a" href="{:U('edit',Array('menu_id'=>$list['menu_id']))}">修改</a>&nbsp;
                    <a class="btn_a2" href="{:U('del',Array('menu_id'=>$list['menu_id']))}" onclick="return confirm('确定删除吗？')">删除</a></td>
            </tr>
        </foreach>
        </tbody>
        <tfoot>
            <tr><td colspan="10"><div class="page">{$page}</div></td>
            </tr>
        </tfoot>
    </table>
</div>
<script type="text/javascript">
    //设置已选择类别
    $("#parent_id").val("{$current_id}");
    // 类别变化刷新页面
    $("#parent_id").change(function(){
        var parent_id = $("#parent_id").val();
        document.location = '?parent_id='+parent_id;
    });
</script>
